package com.kim.module.server.config;

import com.kim.logs.core.configurers.LogerAppenderConfigurer;
import com.kim.logs.core.configurers.LogerAppernderServiceConfigurer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;
import org.zxp.esclientrhl.repository.ElasticsearchTemplate;

import javax.annotation.Resource;
import javax.sql.DataSource;

@Configuration
public class LogerAppenderConfig implements LogerAppenderConfigurer {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private DataSource dataSource;
    @Resource
    private ElasticsearchTemplate elasticsearchTemplate;

    @Override
    public void configure(LogerAppernderServiceConfigurer configurer) throws Exception {
        //mysql模式
//        configurer.jdbc(dataSource).sysCode("日志模块");
        // 文件模式
//         configurer.inFile().sysCode("demo-system").logFilePath("demo-system.log");
        //es存储
        configurer.es(elasticsearchTemplate).sysCode("日志模块");
    }
}
